<?php

namespace App\Repository\Models;

use Illuminate\Database\Eloquent\Model;
use Prettus\Repository\Contracts\Transformable;
use Prettus\Repository\Traits\TransformableTrait;
use Illuminate\Database\Eloquent\SoftDeletes;
use Illuminate\Auth\Authenticatable;

/**
 * Class Advertisement.
 *
 * @package namespace App\Repository\Models;
 */
class Advertisement extends Model implements Transformable
{
    use TransformableTrait;
    use Authenticatable;
    use SoftDeletes;

    /**
     * The attributes that are mass assignable.
     *
     * @var array
     */
    protected $table = 'advertisement';
    protected $fillable = ['id','title','position','typeid','image','textads','url','sort','audit','created_at','updated_at','deleted_at'];


    //广告位置读取
    public  function AdvertisementPosition(){
        return $this->hasOne(AdvertisementPosition::class, 'id', 'position');
    }

    //分类名称读取
    public  function ProductCategories(){
        return $this->hasOne(ProductCategories::class, 'id', 'typeid');
    }

}
